'''
Created on Mar 24, 2011

@author: david
'''

from pspy.der import PspyAction

class Poke(PspyAction):
    
    def execute(self):
        """
        main profile  
        """
        # mark for JSON output
        nxtPage = "/json_out"
        req = self._request
        
        insults = ["Jerk!","Twit!","Idiot!","Your Mother was a Hamster!",
                   "Dolt!","Schmuck!","You Wiper of Other Peoples Bottoms!",
                   "Putz!","Piss Off!","Your Father Smelled of Elderberry","Bugger Off!",
                   "Butt Head!", "Go Away!"]
        
        from mx.DateTime import now
        
        # psuedo randomness
        i = int(now().ticks()) % len(insults)
        
        print "~~ Response: %s" % insults[i]
        
        # format JSON response
        req.setAttribute("jsonResponse",'{"response":"%s"}' % insults[i])
 
        req.setResponsePage(nxtPage)
        
        return req.getResponse()
    